﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.SharePoint;
using Microsoft.SharePoint.Security;

namespace SPBusiness.ExtensionMethods
{
    public static class ExtSPViewCollection
    {


        public static SPView TryGetViewtByTitle(this SPViewCollection vSPViewCollection, string vTitle)
        {
            SPView vSPView = null;

            vSPView = vSPViewCollection.OfType<SPView>().FirstOrDefault(x => x.Title == vTitle);

            return vSPView;
        }

        public static SPView TryGetViewtByID(this SPViewCollection vSPViewCollection, Guid vID)
        {
            SPView vSPView = null;

            vSPView = vSPViewCollection.OfType<SPView>().FirstOrDefault(x => x.ID == vID);

            return vSPView;
        }

    }
}
